/* eslint-disable vue/no-unused-components */
<template>
  <div class="home">
    <top-view></top-view>
    <sales-view></sales-view>
    <bottom-view></bottom-view>
    <map-view></map-view>
  </div>
</template>

<script>
// @ is an alias to /src
import TopView from '../components/TopView'
import SalesView from '../components/SalesView'
import BottomView from '../components/BottomView'
import MapView from '../components/MapView'
import { wordcloud, scatter, screendata } from '../httpRequest'

export default {
  name: 'Home',
  components: {
    TopView,
    SalesView,
    BottomView,
    MapView
  },
  data() {
    return {
      wordcloudData: null, // 词云数据
      scatterData: null, // 报表地图散点数据
      screenData: null // 大屏数据
    }
  },
  methods: {
    getScatterDate() {
      return this.scatterData
    },
    getScreenData() {
      return this.screenData
    },
    getWordcloudData() {
      return this.wordcloudData
    }
  },
  provide() {
    return {
      getWordcloudData: this.getWordcloudData, // 词云数据
      getScatterDate: this.getScatterDate, // 报表地图散点数据
      getScreenData: this.getScreenData // 大屏数据
    }
  },
  mounted() {
    wordcloud().then((data) => {
      this.wordcloudData = data
    })
    scatter().then((data) => {
      this.scatterData = data
    })
    screendata().then((data) => {
      this.screenData = data
    })
  }
}
</script>

<style lang="scss">
.home {
  width: 100%;
  padding: 20px;
  background: #eee;
  box-sizing: border-box;
}
</style>
